package xyz.shenmegui.foodcheckserver.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xyz.shenmegui.foodcheckserver.http.HttpResponse;
import xyz.shenmegui.foodcheckserver.service.CompoundService;

import java.util.HashMap;

@RestController
@RequestMapping("/rank")
public class RankingController {

    @Autowired
    private CompoundService compoundService;

    @RequestMapping("/top10")
    public HttpResponse getTop10() {
        HashMap<String, Object> result = new HashMap<>();
        result.put("top10", compoundService.selectTop10());
        return HttpResponse.ok(result);
    }
}
